package com.service.gmall.product.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.service.gmall.model.product.BaseCategory3;
import com.service.gmall.model.to.CategoryViewTo;
import com.service.gmall.product.service.BaseCategory3Service;
import com.service.gmall.product.mapper.BaseCategory3Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author alpha
* @description 针对表【base_category3(三级分类表)】的数据库操作Service实现
* @createDate 2022-08-22 22:45:59
*/
@Service
public class BaseCategory3ServiceImpl extends ServiceImpl<BaseCategory3Mapper, BaseCategory3>
    implements BaseCategory3Service{

    @Autowired
    BaseCategory3Mapper baseCategory3Mapper;

    @Override
    public List<BaseCategory3> getCategory3(Long category2Id) {
        List<BaseCategory3> baseCategory3s = baseCategory3Mapper.selectList(new LambdaQueryWrapper<BaseCategory3>()
                .eq(BaseCategory3::getCategory2Id, category2Id));
        return baseCategory3s;
    }

    @Override
    public CategoryViewTo getCategoryView(Long category3Id) {
        CategoryViewTo categoryViewTo =baseCategory3Mapper.getCategoryView(category3Id);
        return categoryViewTo;
    }
}




